﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace AlexTranslator
{
    public class Logger
    {
        public static string baseFolder = AppDomain.CurrentDomain.BaseDirectory;
        public readonly string logFolder = baseFolder + @"logs\";

        private string fileName;
        private static Logger logger;

        private Logger()
        {
            Directory.CreateDirectory(logFolder);
            fileName = logFolder +DateTime.Now.ToString("d h-m-s") + "_log.txt";
        }

        private static Logger GetLogger()
        {
            if (logger == null)
            {
                logger = new Logger();
                Write("=Start=");
                return logger;
            }
            else
                return logger;

        }

        public static void Write(string msg)
        {
            File.AppendAllText(Logger.GetLogger().fileName, DateTime.Now.ToString("dd-hh:mm:ss : ") + msg + "\n");
        }

    }    
}
